import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:rembercount/controller/themeController.dart';

class SettingsPage extends StatelessWidget {
  const SettingsPage({super.key});

  @override
  Widget build(BuildContext context) {
    final themeController = Get.find<ThemeController>();
    
    final List<Color> themeColors = [
      const Color(0xFF2D9596), // 默认颜色
      Colors.blue,
      Colors.purple,
      Colors.orange,
      Colors.pink,
      Colors.teal,
      Colors.indigo,
      Colors.amber,
    ];

    return Scaffold(
      backgroundColor: Colors.white,
      appBar: AppBar(
        backgroundColor: Colors.white,
        elevation: 0,
        title: Text(
          '设置',
          style: TextStyle(
            color: themeController.themeColor,
            fontSize: 20,
            fontWeight: FontWeight.bold,
          ),
        ),
        centerTitle: true,
        leading: IconButton(
          icon: Icon(Icons.arrow_back, color: themeController.themeColor),
          onPressed: () => Get.back(),
        ),
      ),
      body: ListView(
        padding: const EdgeInsets.all(16),
        children: [
          const Text(
            '主题颜色',
            style: TextStyle(
              fontSize: 18,
              fontWeight: FontWeight.bold,
            ),
          ),
          const SizedBox(height: 16),
          Wrap(
            spacing: 16,
            runSpacing: 16,
            children: themeColors.map((color) {
              final isSelected = themeController.themeColor == color;
              return InkWell(
                onTap: () => themeController.setThemeColor(color),
                child: Container(
                  width: 48,
                  height: 48,
                  decoration: BoxDecoration(
                    color: color,
                    shape: BoxShape.circle,
                    border: Border.all(
                      color: isSelected ? Colors.black : Colors.transparent,
                      width: 2,
                    ),
                    boxShadow: [
                      BoxShadow(
                        color: color.withOpacity(0.3),
                        blurRadius: 8,
                        spreadRadius: 2,
                      ),
                    ],
                  ),
                  child: isSelected
                      ? const Icon(
                          Icons.check,
                          color: Colors.white,
                          size: 24,
                        )
                      : null,
                ),
              );
            }).toList(),
          ),
          const SizedBox(height: 16),
          Divider(),
          InkWell(
            child: ListTile(
               leading: Icon(Icons.app_registration,),
               title:Text('注册'),
          ),
          onTap: () => Get.toNamed('/register'),
          ),
          Divider(),
          InkWell(
            child: ListTile(
               leading: Icon(Icons.login,),
               title:Text('登录'),
          ),
          onTap: () => Get.toNamed('/login'),
          )
          
        ],
      ),
    );
  }
} 